/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Contingency.impl;

import EA_Model.IEC61970.Contingency.ContingencyEquipment;
import EA_Model.IEC61970.Contingency.ContingencyEquipmentStatusKind;
import EA_Model.IEC61970.Contingency.ContingencyPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Equipment</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Contingency.impl.ContingencyEquipmentImpl#getContingentStatus <em>Contingent Status</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ContingencyEquipmentImpl extends ContingencyElementImpl implements ContingencyEquipment {
	/**
	 * The default value of the '{@link #getContingentStatus() <em>Contingent Status</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getContingentStatus()
	 * @generated
	 * @ordered
	 */
	protected static final ContingencyEquipmentStatusKind CONTINGENT_STATUS_EDEFAULT = ContingencyEquipmentStatusKind.IN_SERVICE;

	/**
	 * The cached value of the '{@link #getContingentStatus() <em>Contingent Status</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getContingentStatus()
	 * @generated
	 * @ordered
	 */
	protected ContingencyEquipmentStatusKind contingentStatus = CONTINGENT_STATUS_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ContingencyEquipmentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ContingencyPackage.Literals.CONTINGENCY_EQUIPMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ContingencyEquipmentStatusKind getContingentStatus() {
		return contingentStatus;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setContingentStatus(ContingencyEquipmentStatusKind newContingentStatus) {
		ContingencyEquipmentStatusKind oldContingentStatus = contingentStatus;
		contingentStatus = newContingentStatus == null ? CONTINGENT_STATUS_EDEFAULT : newContingentStatus;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ContingencyPackage.CONTINGENCY_EQUIPMENT__CONTINGENT_STATUS, oldContingentStatus, contingentStatus));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ContingencyPackage.CONTINGENCY_EQUIPMENT__CONTINGENT_STATUS:
				return getContingentStatus();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ContingencyPackage.CONTINGENCY_EQUIPMENT__CONTINGENT_STATUS:
				setContingentStatus((ContingencyEquipmentStatusKind)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ContingencyPackage.CONTINGENCY_EQUIPMENT__CONTINGENT_STATUS:
				setContingentStatus(CONTINGENT_STATUS_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ContingencyPackage.CONTINGENCY_EQUIPMENT__CONTINGENT_STATUS:
				return contingentStatus != CONTINGENT_STATUS_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (contingentStatus: ");
		result.append(contingentStatus);
		result.append(')');
		return result.toString();
	}

} //ContingencyEquipmentImpl
